namespace GroupSix.Domain.ValueObjects;

/// <summary>
/// 登录结果值对象
/// </summary>
public class LoginResult
{
    public bool IsSuccess { get; private set; }
    public bool IsLocked { get; private set; }
    public int FailCount { get; private set; }
    public DateTime? LockoutEndTime { get; private set; }
    public string? ErrorMessage { get; private set; }

    private LoginResult() { }

    public static LoginResult Success()
    {
        return new LoginResult
        {
            IsSuccess = true
        };
    }

    public static LoginResult Failed(int failCount)
    {
        return new LoginResult
        {
            IsSuccess = false,
            FailCount = failCount,
            ErrorMessage = "用户名或密码错误"
        };
    }

    public static LoginResult Locked(DateTime lockoutEndTime)
    {
        return new LoginResult
        {
            IsSuccess = false,
            IsLocked = true,
            LockoutEndTime = lockoutEndTime,
            ErrorMessage = $"账户已锁定至{lockoutEndTime:yyyy-MM-dd HH:mm:ss}"
        };
    }
} 